  <?php 
  $array_cart=array();
			if(isset($_SESSION['cart']))
				$array_cart=$_SESSION['cart'];
  ?>
  <script type="text/javascript">
<!--
function del_cart(id_deal){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
											  document.getElementById('count_cart').innerHTML=xmlhttp.responseText;
											  load_cart();
										  }
									  }
	xmlhttp.open("GET","<?php echo base_url("cart/del_cart")?>?id_deal="+id_deal,true);
	xmlhttp.send();
	
}
function changeQuantity(id_deal,quantity){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
											  load_cart();
										  }
									  }
	xmlhttp.open("GET","<?php echo base_url("cart/changeQuantity")?>?id_deal="+id_deal+"&quantity="+quantity,true);
	xmlhttp.send();
	
}
function load_cart(){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
											  document.getElementById('cart_content').innerHTML=xmlhttp.responseText;
										  }
									  }
	xmlhttp.open("GET","<?php echo base_url("cart/load_cart")?>",true);
	xmlhttp.send();
	
}
//-->
</script>
  <div class="giohang3">
    <div class=" step_buy step_giohang"></div>
    <div class="cart_content">
      <h2 class="title_cart">Thông tin đơn hàng của bạn</h2>
      <div id="cart_content">
      <table class="cart_info" width="100%" border="1" cellspacing="0" cellpadding="5">
        <tr >
          <th class="delete">Xoá</th>
          <th class="mane_dv">Sản phẩm/Dịch vụ</th>
          <th class="dongia">Đơn giá</th>
          <th class="soluong">Số lượng</th>
          <th class="thanhtien">Thành tiền</th>
        </tr>
        <?php 
        $tong=0;
        foreach ($array_cart as $value =>$giatri){
        	$tong+=($giatri[1]*$giatri[6]);
        	?>
        <tr>
          <td class="delete"><a onclick="del_cart(<?=$giatri[0]?>);" style="cursor: pointer;"><img src="<?php echo base_url("images/btn_del_item.png"); ?>" width="20" height="20" alt="Delete" /></a></td>
          <td class="name"><a href="<?=base_url('deal_detail?did='.$giatri[0])?>"> <?=$giatri[3]?></a></td>
          <td class="dongia"><?=number_format($giatri[6])?></td>
          <td class="soluong">
         														 <select style="min-width:50px" onchange="changeQuantity(<?=$giatri[0]?>,this.value)">
                                                                  <option value="1" <?php if($giatri[1]==1) echo ' selected="selected"';?>>1</option>
                                                                  <option value="2" <?php if($giatri[1]==2) echo ' selected="selected"';?>>2</option>
                                                                  <option value="3" <?php if($giatri[1]==3) echo ' selected="selected"';?>>3</option>
                                                                  <option value="4" <?php if($giatri[1]==4) echo ' selected="selected"';?>>4</option>
                                                                  <option value="5" <?php if($giatri[1]==5) echo ' selected="selected"';?>>5</option>
                                                                  <option value="6" <?php if($giatri[1]==6) echo ' selected="selected"';?>>6</option>
                                                                  <option value="7" <?php if($giatri[1]==7) echo ' selected="selected"';?>>7</option>
                                                                  <option value="8" <?php if($giatri[1]==8) echo ' selected="selected"';?>>8</option>
                                                                  <option value="9" <?php if($giatri[1]==9) echo ' selected="selected"';?>>9</option>
                                                                  <option value="10" <?php if($giatri[1]==10) echo ' selected="selected"';?>>10</option>
                                                                </select>
          </td>
          <td class="thanhtien"><?=number_format($giatri[1]*$giatri[6])?></td>
        </tr>
       <?php }?>
        <tr>
          <td colspan="4" class="tong" >Tổng cộng</td>
          <td><?=number_format($tong)?></td>
        </tr>
      </table>
      </div>
      <div style="height:120px;">
        <div class="continous-shop"><a href="<?=base_url('home')?>">Tiếp tục mua hàng</a></div>
        <div class="finish_order"><a href="<?=base_url('payment')?>">Thanh toán</a></div>
      </div>
      
    </div>
  </div>
  <!-- end product info -->
  
  <div class="right_section">
    <h2>Deal hôm nay</h2>
    <ul>
    
     <?php foreach ($list_deal_today as $value){	?>
      <li>
         <h3><a href="<?=base_url('deal_detail?did='.$value['id'])?>"><?=$value['name']?></a></h3>
         <a href="<?=base_url('deal_detail?did='.$value['id'])?>">
        <div class="ar_info" style="background: url(<?php echo base_url($value['small_image']); ?>) repeat scroll center center / cover transparent;">
        <span class="sale-off-de">-<?=$value['sale_off']?>%</span>
          <div class="pro_price">
            <p class="prior">Giá gốc: <span ><?=number_format($value['price'])?>đ</span></p>
            <p class="prinow"><?=number_format($value['price_sale_off'])?>đ</p>
          </div>
        </div>
        </a>
      </li>
      <?php }?>
    </ul>
     <!-- <p class="xemthem"><a href="<?=base_url('dealtoday')?>">Xem thêm >></a></p>  -->
  </div>
  <!-- end right section --> 
